package dao;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;

  
  
/**
 * This class was autogenerated by Torque on:
 *
 * [Fri Jan 09 02:39:32 PST 2009]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Region
 */
public abstract class BaseRegion extends BaseObject
{
    /** The Peer class */
    private static final RegionPeer peer =
        new RegionPeer();

        
    /** The value for the regionid field */
    private int regionid;
      
    /** The value for the regioncode field */
    private String regioncode;
      
    /** The value for the regionname field */
    private String regionname;
      
    /** The value for the countryid field */
    private int countryid;
  
    
    /**
     * Get the Regionid
     *
     * @return int
     */
    public int getRegionid()
    {
        return regionid;
    }

                                              
    /**
     * Set the value of Regionid
     *
     * @param v new value
     */
    public void setRegionid(int v) throws TorqueException
    {
    
                  if (this.regionid != v)
              {
            this.regionid = v;
            setModified(true);
        }
    
          
                                  
        // update associated Province
        if (collProvinces != null)
        {
            for (int i = 0; i < collProvinces.size(); i++)
            {
                ((Province) collProvinces.get(i))
                    .setRegionid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByResidentialaddressregionid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByResidentialaddressregionid.get(i))
                    .setResidentialaddressregionid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByCollegeaddressregionid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByCollegeaddressregionid.get(i))
                    .setCollegeaddressregionid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByGuardianaddressregionid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByGuardianaddressregionid.get(i))
                    .setGuardianaddressregionid(v);
            }
        }
                      }
  
    /**
     * Get the Regioncode
     *
     * @return String
     */
    public String getRegioncode()
    {
        return regioncode;
    }

                        
    /**
     * Set the value of Regioncode
     *
     * @param v new value
     */
    public void setRegioncode(String v) 
    {
    
                  if (!ObjectUtils.equals(this.regioncode, v))
              {
            this.regioncode = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Regionname
     *
     * @return String
     */
    public String getRegionname()
    {
        return regionname;
    }

                        
    /**
     * Set the value of Regionname
     *
     * @param v new value
     */
    public void setRegionname(String v) 
    {
    
                  if (!ObjectUtils.equals(this.regionname, v))
              {
            this.regionname = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Countryid
     *
     * @return int
     */
    public int getCountryid()
    {
        return countryid;
    }

                              
    /**
     * Set the value of Countryid
     *
     * @param v new value
     */
    public void setCountryid(int v) throws TorqueException
    {
    
                  if (this.countryid != v)
              {
            this.countryid = v;
            setModified(true);
        }
    
                          
                if (aCountry != null && !(aCountry.getCountryid() == v))
                {
            aCountry = null;
        }
      
              }
  
      
    
                  
    
        private Country aCountry;

    /**
     * Declares an association between this object and a Country object
     *
     * @param v Country
     * @throws TorqueException
     */
    public void setCountry(Country v) throws TorqueException
    {
            if (v == null)
        {
                    setCountryid(0);
                  }
        else
        {
            setCountryid(v.getCountryid());
        }
                aCountry = v;
    }

                                            
    /**
     * Get the associated Country object
     *
     * @return the associated Country object
     * @throws TorqueException
     */
    public Country getCountry() throws TorqueException
    {
        if (aCountry == null && (this.countryid > 0))
        {
                          aCountry = CountryPeer.retrieveByPK(SimpleKey.keyFor(this.countryid));
              
            /* The following can be used instead of the line above to
               guarantee the related object contains a reference
               to this object, but this level of coupling
               may be undesirable in many circumstances.
               As it can lead to a db query with many results that may
               never be used.
               Country obj = CountryPeer.retrieveByPK(this.countryid);
               obj.addRegions(this);
            */
        }
        return aCountry;
    }

    /**
     * Provides convenient way to set a relationship based on a
     * ObjectKey.  e.g.
     * <code>bar.setFooKey(foo.getPrimaryKey())</code>
     *
           */
    public void setCountryKey(ObjectKey key) throws TorqueException
    {
      
                        setCountryid(((NumberKey) key).intValue());
                  }
       
                                
            
    /**
     * Collection to store aggregation of collProvinces
     */
    protected List collProvinces;

    /**
     * Temporary storage of collProvinces to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initProvinces()
    {
        if (collProvinces == null)
        {
            collProvinces = new ArrayList();
        }
    }

    /**
     * Method called to associate a Province object to this object
     * through the Province foreign key attribute
     *
     * @param l Province
     * @throws TorqueException
     */
    public void addProvince(Province l) throws TorqueException
    {
        getProvinces().add(l);
        l.setRegion((Region) this);
    }

    /**
     * The criteria used to select the current contents of collProvinces
     */
    private Criteria lastProvincesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getProvinces(new Criteria())
     *
     * @throws TorqueException
     */
    public List getProvinces() throws TorqueException
    {
        if (collProvinces == null)
        {
            collProvinces = getProvinces(new Criteria(10));
        }
        return collProvinces;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region has previously
     * been saved, it will retrieve related Provinces from storage.
     * If this Region is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getProvinces(Criteria criteria) throws TorqueException
    {
        if (collProvinces == null)
        {
            if (isNew())
            {
               collProvinces = new ArrayList();
            }
            else
            {
                      criteria.add(ProvincePeer.REGIONID, getRegionid() );
                      collProvinces = ProvincePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(ProvincePeer.REGIONID, getRegionid());
                      if (!lastProvincesCriteria.equals(criteria))
                {
                    collProvinces = ProvincePeer.doSelect(criteria);
                }
            }
        }
        lastProvincesCriteria = criteria;

        return collProvinces;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getProvinces(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getProvinces(Connection con) throws TorqueException
    {
        if (collProvinces == null)
        {
            collProvinces = getProvinces(new Criteria(10), con);
        }
        return collProvinces;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region has previously
     * been saved, it will retrieve related Provinces from storage.
     * If this Region is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getProvinces(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collProvinces == null)
        {
            if (isNew())
            {
               collProvinces = new ArrayList();
            }
            else
            {
                       criteria.add(ProvincePeer.REGIONID, getRegionid());
                       collProvinces = ProvincePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(ProvincePeer.REGIONID, getRegionid());
                       if (!lastProvincesCriteria.equals(criteria))
                 {
                     collProvinces = ProvincePeer.doSelect(criteria, con);
                 }
             }
         }
         lastProvincesCriteria = criteria;

         return collProvinces;
     }

                  
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related Provinces from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getProvincesJoinRegion(Criteria criteria)
        throws TorqueException
    {
        if (collProvinces == null)
        {
            if (isNew())
            {
               collProvinces = new ArrayList();
            }
            else
            {
                            criteria.add(ProvincePeer.REGIONID, getRegionid());
                            collProvinces = ProvincePeer.doSelectJoinRegion(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(ProvincePeer.REGIONID, getRegionid());
                        if (!lastProvincesCriteria.equals(criteria))
            {
                collProvinces = ProvincePeer.doSelectJoinRegion(criteria);
            }
        }
        lastProvincesCriteria = criteria;

        return collProvinces;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByResidentialaddressregionid
     */
    protected List collStudentPersonalInformationsRelatedByResidentialaddressregionid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByResidentialaddressregionid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByResidentialaddressregionid()
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByResidentialaddressregionid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByResidentialaddressregionid().add(l);
        l.setRegionRelatedByResidentialaddressregionid((Region) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByResidentialaddressregionid
     */
    private Criteria lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByResidentialaddressregionid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddressregionid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddressregionid = getStudentPersonalInformationsRelatedByResidentialaddressregionid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     * If this Region is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddressregionid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid() );
                      collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                      if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByResidentialaddressregionid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddressregionid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddressregionid = getStudentPersonalInformationsRelatedByResidentialaddressregionid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     * If this Region is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddressregionid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                       collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                       if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressregionidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressregionid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByCollegeaddressregionid
     */
    protected List collStudentPersonalInformationsRelatedByCollegeaddressregionid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByCollegeaddressregionid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByCollegeaddressregionid()
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByCollegeaddressregionid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByCollegeaddressregionid().add(l);
        l.setRegionRelatedByCollegeaddressregionid((Region) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByCollegeaddressregionid
     */
    private Criteria lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByCollegeaddressregionid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddressregionid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddressregionid = getStudentPersonalInformationsRelatedByCollegeaddressregionid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     * If this Region is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddressregionid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid() );
                      collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                      if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByCollegeaddressregionid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddressregionid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddressregionid = getStudentPersonalInformationsRelatedByCollegeaddressregionid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     * If this Region is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddressregionid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                       collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                       if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressregionidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressregionid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByGuardianaddressregionid
     */
    protected List collStudentPersonalInformationsRelatedByGuardianaddressregionid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByGuardianaddressregionid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByGuardianaddressregionid()
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByGuardianaddressregionid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByGuardianaddressregionid().add(l);
        l.setRegionRelatedByGuardianaddressregionid((Region) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByGuardianaddressregionid
     */
    private Criteria lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByGuardianaddressregionid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddressregionid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddressregionid = getStudentPersonalInformationsRelatedByGuardianaddressregionid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     * If this Region is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddressregionid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid() );
                      collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                      if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByGuardianaddressregionid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddressregionid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddressregionid = getStudentPersonalInformationsRelatedByGuardianaddressregionid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     * If this Region is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddressregionid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                       collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                       if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Region is new, it will return
     * an empty collection; or if this Region has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressregionid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Region.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressregionidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressregionid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressregionid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                            collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSREGIONID, getRegionid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressregionid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressregionidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressregionid;
    }
                            


          
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
              fieldNames.add("Regionid");
              fieldNames.add("Regioncode");
              fieldNames.add("Regionname");
              fieldNames.add("Countryid");
              fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
          if (name.equals("Regionid"))
        {
                return new Integer(getRegionid());
            }
          if (name.equals("Regioncode"))
        {
                return getRegioncode();
            }
          if (name.equals("Regionname"))
        {
                return getRegionname();
            }
          if (name.equals("Countryid"))
        {
                return new Integer(getCountryid());
            }
          return null;
    }
    
    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
          if (name.equals(RegionPeer.REGIONID))
        {
                return new Integer(getRegionid());
            }
          if (name.equals(RegionPeer.REGIONCODE))
        {
                return getRegioncode();
            }
          if (name.equals(RegionPeer.REGIONNAME))
        {
                return getRegionname();
            }
          if (name.equals(RegionPeer.COUNTRYID))
        {
                return new Integer(getCountryid());
            }
          return null;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
            if (pos == 0)
        {
                return new Integer(getRegionid());
            }
              if (pos == 1)
        {
                return getRegioncode();
            }
              if (pos == 2)
        {
                return getRegionname();
            }
              if (pos == 3)
        {
                return new Integer(getCountryid());
            }
              return null;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
          save(RegionPeer.getMapBuilder()
                .getDatabaseMap().getName());
      }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
       * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
       *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
          try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
      }

      /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
          if (!alreadyInSave)
        {
            alreadyInSave = true;


  
            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    RegionPeer.doInsert((Region) this, con);
                    setNew(false);
                }
                else
                {
                    RegionPeer.doUpdate((Region) this, con);
                }
            }

                                      
                
            if (collProvinces != null)
            {
                for (int i = 0; i < collProvinces.size(); i++)
                {
                    ((Province) collProvinces.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByResidentialaddressregionid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByResidentialaddressregionid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByResidentialaddressregionid.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByCollegeaddressregionid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByCollegeaddressregionid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByCollegeaddressregionid.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByGuardianaddressregionid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByGuardianaddressregionid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByGuardianaddressregionid.get(i)).save(con);
                }
            }
                          alreadyInSave = false;
        }
      }


                          
      /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param  regionid ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
            setRegionid(((NumberKey) key).intValue());
        }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
            setRegionid(Integer.parseInt(key));
        }

  
    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
          return SimpleKey.keyFor(getRegionid());
      }

 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
     * related objects to isNew=true.
       */
      public Region copy() throws TorqueException
    {
        return copyInto(new Region());
    }
  
    protected Region copyInto(Region copyObj) throws TorqueException
    {
          copyObj.setRegionid(regionid);
          copyObj.setRegioncode(regioncode);
          copyObj.setRegionname(regionname);
          copyObj.setCountryid(countryid);
  
                    copyObj.setRegionid(0);
                              
                                      
                
        List v = getProvinces();
        for (int i = 0; i < v.size(); i++)
        {
            Province obj = (Province) v.get(i);
            copyObj.addProvince(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByResidentialaddressregionid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByResidentialaddressregionid(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByCollegeaddressregionid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByCollegeaddressregionid(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByGuardianaddressregionid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByGuardianaddressregionid(obj.copy());
        }
                    
        return copyObj;
    }

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public RegionPeer getPeer()
    {
        return peer;
    }

    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Region:\n");
        str.append("Regionid = ")
           .append(getRegionid())
           .append("\n");
        str.append("Regioncode = ")
           .append(getRegioncode())
           .append("\n");
        str.append("Regionname = ")
           .append(getRegionname())
           .append("\n");
        str.append("Countryid = ")
           .append(getCountryid())
           .append("\n");
        return(str.toString());
    }
}
